import yaml
import os

class ErrorManager:

    def __load_error_config(self, config_file: str) -> object:
        print(config_file)
        if os.path.isfile(config_file):
            with open(config_file, "r") as f:
                return yaml.safe_load(f)
        else:
            print("配置文件不存在，请确认配置文件存在")
            exit(-1)

    def config_read(self, config_file: str):
        cf = self.__load_error_config(config_file)
        print(cf)
        return cf

class ErrorObject:
    def __init__(self, name: str,  desc: str, rule_regex: str, scheme: str):
        self.name = name
        self.desc = desc
        self.rule = rule_regex
        self.scheme = scheme


if __name__ == "__main__":
    print("开始加载配置")
    manager = ErrorManager()
    config = manager.config_read("./ERROR_MAPPING.yml")


